package com.stlm2.dems.entity;

/**
 * 快递公司
 */
public enum ExpressType {
	YuanTong(1, "圆通速递"),
	ShenTong(2, "申通快递"),
	HuiTongKuaiDi(3, "汇通"),
	ZhongTong(4, "中通速递"),
	YunDa(5, "韵达快运"),
	YouZhengGuoNei(6, "邮政包裹"),
	TianTian(7, "天天快递"),
	ShunFeng(8, "顺丰速递"),
	EMS(9, "EMS"),
	ZhaiJiSong(10, "宅急送"),
	QuanFengKuaiDi(11, "全峰快递"),
	DeBangKuaiDi(12, "德邦快递");


	private final int val;
	private final String desc;

	ExpressType(int val, String desc) {
		this.val = val;
		this.desc = desc;
	}
	
	public String toString(){
		return desc;
	}

	/**
	 * 获得快递公司代码
	 * @return
	 */
	public String getCom(){
		return this.name().toLowerCase();
	}

	public int getIntValue() {
		return val;
	}

    public static ExpressType getByName(String name) {
        if ("圆通速递".equals(name)) {
            return YuanTong;
        } else if ("申通快递".equals(name)) {
            return ShenTong;
        } else if ("汇通".equals(name)) {
            return HuiTongKuaiDi;
        } else if ("中通速递".equals(name)) {
            return ZhongTong;
        } else if ("韵达快运".equals(name)) {
            return YunDa;
        } else if ("邮政包裹".equals(name)) {
            return YouZhengGuoNei;
        } else if ("天天快递".equals(name)) {
            return TianTian;
        } else if ("顺丰速递".equals(name)) {
            return ShunFeng;
        } else if ("EMS".equals(name)) {
            return EMS;
        } else if ("宅急送".equals(name)) {
            return ZhaiJiSong;
        } else if ("全峰快递".equals(name)) {
			return QuanFengKuaiDi;
		} else if ("德邦快递".equals(name)) {
			return DeBangKuaiDi;
		}
        return null;
    }

	public static ExpressType getByIntValue(int n) {
		switch (n) {
			case 1:
				return YuanTong;
			case 2:
				return ShenTong;
			case 3:
				return HuiTongKuaiDi;
			case 4:
				return ZhongTong;
			case 5:
				return YunDa;
			case 6:
				return YouZhengGuoNei;
			case 7:
				return TianTian;
			case 8:
				return ShunFeng;
			case 9:
				return EMS;
			case 10:
				return ZhaiJiSong;
			case 11:
				return QuanFengKuaiDi;
			case 12:
				return DeBangKuaiDi;
		default:
			return null;
		}
	}
}
